#include <stdio.h>

void triangle(int n)
{
	int a[30][30] = {1};
	int i = 0, j = 0;
	
	for (i = 1; i < n; i++)
	{
		a[i][0] = 1;
		for (j = 1; j <= i; j++)
		{
			a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
		}
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j<=i; j++)
		{
			printf("%d ", a[i][j]);
		}
		printf("\n");
	}
}

int main()
{
	triangle(5);
	return 0;
}